import java.util.ArrayList;


public class TokenList extends ArrayList<Token> {
	
	
	public TokenList() {
		this.add(new Token("program", Tokens.PROGRAM));
		this.add(new Token("begin", Tokens.BEGIN));
		this.add(new Token("end", Tokens.END));
		this.add(new Token("int", Tokens.INT));
		this.add(new Token("if", Tokens.IF));
		this.add(new Token("then", Tokens.THEN));
		this.add(new Token("else", Tokens.ELSE));
		this.add(new Token("while", Tokens.WHILE));
		this.add(new Token("loop", Tokens.LOOP));
		this.add(new Token("read", Tokens.READ));
		this.add(new Token("write", Tokens.WRITE));
		this.add(new Token(";", Tokens.SEMICOLON));
		this.add(new Token(",", Tokens.COMMA));
		this.add(new Token("=", Tokens.EQUAL));
		this.add(new Token("!", Tokens.EXCLAMATION));
		this.add(new Token("[", Tokens.LEFT_BRACK));
		this.add(new Token("]", Tokens.RIGHT_BRACK));
		this.add(new Token("&&", Tokens.AND_OP));
		this.add(new Token("||", Tokens.OR_OP));
		this.add(new Token("(", Tokens.RIGHT_PAREN));
		this.add(new Token(")", Tokens.LEFT_PAREN));
		this.add(new Token("+", Tokens.PLUS_OP));
		this.add(new Token("-", Tokens.MINUS_OP));
		this.add(new Token("*", Tokens.STAR_OP));
		this.add(new Token("!=", Tokens.NOT_EQUAL_OP));
		this.add(new Token("==", Tokens.EQUAL_OP));
		this.add(new Token("<", Tokens.LESSTHAN_OP));
		this.add(new Token(">", Tokens.GREATERTHAN_OP));
		this.add(new Token("<=", Tokens.LESSTHAN_EQ_OP));
		this.add(new Token(">=", Tokens.GREATERTHAN_EQ_OP));
	}
	
	public Tokens getTokenNumber (String token) {
		Tokens tok_num = null;
		for (Token t : this) {
			if (t.getToken().equals(token)) {
				tok_num = t.getNumber();
			}
		}
		return tok_num;
	}
	
	public boolean isReservedOrSymbol (String token) {
		for (Token t: this) {
			if (t.getToken().equals(token)) {
				return true;
			}
		}
		return false;
	}
}
